Repository navigation
fix(app-shell): Home sends its deployment-notice, authorized-clients and API-key reads once per load - #34097
Merged
Conversation
…at makes it due Home waits on the launcher's pending flag, but the provider published pending only from its effect, after the first commit. Home therefore drew its page for one frame, swapped it for the loading state, then drew it again, mounting the deployment notice and the connect-assistant card twice and sending their reads twice per load. Claude-Session: https://claude.ai/code/session_01ADHkmPiLw38ErmCpnkcQvh Co-authored-by: Claude <noreply@anthropic.com>
… of reads Home mounts the Connect an AI Assistant card and the administrator's checklist together, and each reader owned its own effect, so the authorized-clients and sys_api_key reads went out once per reader. The reads now live in a store shared by every reader mounted at the same time, re-read on a change to either record, and dropped with the last reader. Claude-Session: https://claude.ai/code/session_01ADHkmPiLw38ErmCpnkcQvh Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmPiLw38ErmCpnkcQvh Co-authored-by: Claude <noreply@anthropic.com>
1 task
…boot reads A list page through the real route tree, real preflight and real AuthProvider, over one recording fetch: auth/get-session, meta/app, auth/me/permissions and me/apps go out once each. Claude-Session: https://claude.ai/code/session_01ADHkmPiLw38ErmCpnkcQvh Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi 维护者速读
席位意见修复在根因处(首帧 pending + 共享 store),而非在调用方加节流;钉子覆盖首页与列表页两条 boot 路径,消融证明有效。同意落地。 席位核对 — ACCEPT · domain:ui#2 · head 908e962 · 2026-11-15T19:21Z |
A commit outside act flushes passive effects on a later task, so the page in the DOM did not yet mean its child's read had run: under a loaded run the launcher case read 0. The gate case now answers /me/apps by hand, waits for the child's read and lets the load run out before counting exactly one; the list-page pin waits for all four reads before counting. Claude-Session: https://claude.ai/code/session_01ADHkmPiLw38ErmCpnkcQvh Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
Relay Merge-queue dequeue of #34097 — cause
The relay sends |
objectstack-fleet
Bot
removed this pull request from the merge queue due to a manual request
Nov 15, 2026
Contributor
Author
|
domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi 维护者速读
席位意见时序竞争在钉子本身,修法是在计数前等待因果上的前置事件,而不是放宽断言;消融证明钉子仍然有效。同意重新落地;落地后关闭 #34150。 席位核对 — ACCEPT · domain:ui#2 · head 00d8090 · 2026-11-15T23:25Z |
This was referenced Nov 15, 2026
This was referenced Nov 16, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Fixes #28085
Clause-②: no
Metadata-protocol: none
维护者速读
@object-ui/app-shell两个文件(另加一个控制台测试文件);首页现在在/me/apps回答之前显示"加载中"(这本来就是该标志声明的行为)。回滚即 revert 本 PR。ui/packages/app-shell/src/hooks/useLauncherApps.tsx(firstReadDue)、ui/packages/app-shell/src/console/connect/connectedAccess.ts(共享读取的生命周期)。pnpm --dir ui exec vitest run packages/app-shell/src/hooks/__tests__/useLauncherApps-26838.test.tsx packages/app-shell/src/console/connect/ConnectAgentWidget.connected-30898.test.tsx,预期 29 个用例全绿;列表页钉子:pnpm --dir ui exec vitest run apps/console/src/__tests__/App.listPageBootReadsOnce-28085.test.tsx,预期 1 个用例绿。What changes
Step 0 measured the card on a production console build (
pnpm console:build, served byobjectstack dev --ui --freshfromexamples/app-showcase, seeded admin, headless Chromium 1440×900, a fresh page per load after sign-in, GETs under/api/counted from navigation to network idle plus 3 s), onmainbc6b7ffd:showcase_task×4,showcase_account×1): every URL is read once.auth/get-session,meta/app,auth/me/permissionsandme/appsread 1 each, andmeta/object?package,sys_user_preferenceandme/localizationread 1 each too. The doubling the card names is still React.StrictMode's development replay, which this PR does not touch.GET /api/settings/deployment/notice×2,GET /api/v1/auth/authorized-clients×3, and thesys_api_keylist ×3. None of them overlapped: each repeat started after the previous one had answered. So sharing an in-flight request (the card's "Wanted") could not remove them. The causes, traced on the Console dev server with StrictMode turned off locally (a local edit, restored) and a React DevTools hook recording mounts:HomePagewaits onuseLauncherApps().pendingso it never draws a tile/me/appsthen hides.LauncherAppsProvidersetpendingonly from its effect, after the first commit, so the first frame had nothing pending and nothing narrowed. Home drew its page (mountingDeploymentNoticeandConnectAssistantCard, which read on mount), switched to its loading state when the effect publishedpending, then drew the page again when the answer came. Now the provider answerspendingfrom the render that makes the first read due. Home draws the page once, after the answer. This also removes the first frame that drew a hidden app's tile, which the hook's own doc says never happens.useConnectedAccess, and each owned its own effects, so each sentauthorized-clientsand thesys_api_keylist. The checklist's reader enables later (after the settings read), so its requests came after the card's had answered.useConnectedAccessnow reads through a store shared by every reader mounted at the same time, keyed by adapter and person. A reader that mounts while the entry lives joins its answer or its reads in flight. A change tosys_api_keyorsys_oauth_consentre-reads that record once for all readers. The entry is dropped with its last reader, so a page mounted later reads afresh, as it did before. The store's subscribe/getSnapshot pair is keyed on the adapter and person outside React, not on a memoised callback (uiAGENTS.mdchore: version packages #10).Both are one-place fixes at the source of each repeat. Neither is a per-call-site guard.
Readings: production console, before and after
Before (
mainbc6b7ffd), Home, one load: 35 GETs; repeated URLsdeployment/notice×2,authorized-clients×3,sys_api_keylist ×3. Timeline of the repeats (ms from navigation, start → end):After (head of this PR, console rebuilt), Home ×3: 30 GETs each, no URL repeated;
deployment/notice1,authorized-clients1,sys_api_keylist 1,me/apps1,meta/app1,me/permissions1,get-session1.List page, before ×5 and after ×3 (
showcase_task,showcase_account): 26 GETs each, no URL repeated; the card's four reads 1 each (meta/appandmeta/app/showcase_app/bundleare two different URLs).Dev server, StrictMode off, mounts recorded through a React DevTools hook (before the fix):
DeploymentNoticeandConnectAssistantCardmounted twice under the sameHomePageelement, each mount followed by its reads; after fix 1, once; after fix 2,authorized-clientsand thesys_api_keylist are sent once, with the checklist mounted.Tests
useLauncherApps-26838.test.tsx, new top-level describethe first /me/apps read is pending from the first render: a page behind Home's gate mounts once, so a child that reads on mount reads once per load (a request count);pendingis true in the very first render when a read is due; and false when none is due (no user, metadata loading, no apps).ConnectAgentWidget.connected-30898.test.tsx, new§7 one pair of reads per page, however many readers: two readers mounted together send each request once; a reader mounting after the answer joins it; asys_api_keychange re-reads that record once for both; a page mounted after every reader left reads afresh.ui/apps/console/src/__tests__/App.listPageBootReadsOnce-28085.test.tsx(new, the card's acceptance pin): a list page (/apps/crm/crm_contact) loads through the real route tree with the bootmain.tsxruns, the realpreflightAuth, thenAppwith the realAuthProvider,AuthGuard,ConnectedShell(realObjectStackAdapterandMetadataProvider),RequireOrganization, the/me/permissionsscope andLauncherAppsProvider, over one stubbed globalfetchthat records every URL.auth/get-session,meta/app,auth/me/permissionsandme/appsare counted at exactly one request each. Only the app's own content and the pages off the route are stubbed, as in the siblingApp.rootLandingReadsOnce-32633. NoReact.StrictMode, since a built console does not replay effects.Ablations (mutation through scripts/ablation-replace.mjs, restored to HEAD, git diff HEAD empty)
useLauncherApps.tsx:const state = firstReadDue ? PENDING : heldState;→const state = heldState;— 2 failed / 9 passed:a page behind the gate mounts once…("expected vi.fn() to be called 1 times, but got 2 times") andis pending in the very first render…("expected [ false ] to deeply equal [ true ]").connectedAccess.ts:let entry = byUser.get(userId);→let entry: SharedReads | undefined = undefined;(one entry per reader) — 3 failed / 15 passed: two readers together, the late reader, and the re-read on change.ui/packages/auth/src/createAuthClient.ts(takePreflightSession, the handoff that keeps the boot at oneget-session):if (!slot || slot.taken) return null;→if (!slot || slot.taken || true) return null;— 1 failed / 0 passed:expected { 'auth/get-session': 2, …(3) } to deeply equal { 'auth/get-session': 1, …(3) }. Restored: blob == HEAD (ab510ed0c019),git diff HEADempty.Acceptance notes
App.listPageBootReadsOnce-28085.test.tsxwith the ablation above (the card's claim amendment widened the surface to that one file).sys_audit_logandsys_user×2 on a record page. Not measured here (record page outside this card's step 0).me/localization, which that reading saw ×2 on the list page, read once on the built console; its files are held for Console boots in the app's default language for a no-locale user even when the browser language is supported — 18.5.0 makes browser detection unreachable (zh-CN browser now gets English) #33985 and are untouched.Verification
All on head
1feba497(merge basebc6b7ffd), after the last commit. The product files are unchanged since76497be1; that round's app-shell checks (pnpm --filter @object-ui/app-shell type-checkexit 0;cd ui && pnpm exec vitest run packages/app-shell/ --maxWorkers=2under the verify lock, Test Files 2270 passed / 1 skipped, Tests 21007 passed / 9 skipped, exit 0) stand for them.cd ui && pnpm exec vitest run apps/console/src/__tests__/App.listPageBootReadsOnce-28085.test.tsx apps/console/src/__tests__/App.rootLandingReadsOnce-32633.test.tsx, twice: 2 files, 3 tests passed each time (the new pin also passed alone once before the ablation).pnpm --filter @object-ui/console type-check(covers the new test file) — exit 0.FirstRunChecklist.test.tsxand the consoleApp.permissionsWave-29114,App.homePermissions-12700,App.rootLandingReadsOnce-32633,App.linkRefusalLanding-33063suites — green.node scripts/pm/dispatch-gates.mjs --ranon1feba497— 37 derived (the same 37 as round 1), 37 run, 0 NOT-MEASURED, 0 UNRUN; the whole round under the verify lock, every family exit 0 on the first run.pnpm check:new-line-citations(ui) — 0 new citations.!in the title and no(narrowing)arm.Derived gate ledger on 1feba49 (CMD :: exit)
Generated by Claude Code